const mysql=require('mysql');
const dbUtil=require('../util/DBUtil')

function select(){
  let sql ='select * from message';
  return dbUtil.query(sql)
}
function query(query){
  let sql="select * from message";
  let where=' where '
  if(query.m_username){
    where+="m_username like '%"+query.m_username+"%'";
  }
  if(query.m_title){
    where+="and m_title like '%"+query.m_title+"%'";
  }
  if(query){
    sql+=where;
  }
  return dbUtil.query(sql);
  console.log(sql);
}
function add(){

}
module.exports={
  select:select,
  query:query,
  add:add
}
